<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

	<ui:composition 
	  xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      template="/view/templates/templateLayout.xhtml">
      
      <ui:define name="conteudo"> 
      <link rel="stylesheet" type="text/css" href="./estilos.css"/>      	
  	
<h:form id="formConsultarCondicaoPagamento" prependId="false">  
	<p:panel id="panelConsultarCondicaoPagamento" header="Consultar CondicaoPagamento" style="margin-bottom:20px; height:200px ">
		<f:facet name="header">
			<h:outputText value="Consultar Condicao de Pagamento" styleClass="outputTextTitulo"/>
		</f:facet>   
 		<p:messages id="messagesConsultarCondPgto" autoUpdate="true" closable="true" /> 
 		<h:panelGrid id="pgCondicaoPagamento" columns="2" style="text-align:center; margin-top:20px; margin-right:10%;">  
            <h:outputLabel value="Código" styleClass="outputLabel"/>  
            <h:outputLabel value="Condição de Pagamento" styleClass="outputLabel"/>             
            <p:inputText value="#{condicaoPagamentoBean.condicaoPagamento.idCondicaoPagamento}" styleClass="inputId">
            	<p:ajax  listener="#{condicaoPagamentoBean.onChangeCondicaoPagamento}" render="pgCondicaoPagamento messages" />
            </p:inputText> 
            <p:inputText  value="#{condicaoPagamentoBean.condicaoPagamento.descricao}" maxlength="40" styleClass="inputDescricao"/>        
		</h:panelGrid>  
    	<h:panelGrid id="pgFormaPagamento" columns="2" styleClass="outputLabel">  
            <h:outputLabel value="Código" styleClass="outputLabel"/>  
            <h:outputLabel value="FormaPagamento" style="font-size:14px; float:left"/>             
            <p:inputText value="#{condicaoPagamentoBean.condicaoPagamento.formaPagamento.idFormaPagamento}" styleClass="inputId">
            	<p:ajax  listener="#{condicaoPagamentoBean.onChangeFormaPagamento}" render="pgFormaPagamento messages" />
            </p:inputText> 
            <p:autoComplete  value="#{condicaoPagamentoBean.condicaoPagamento.formaPagamento.descricao}" maxlength="40"
                    completeMethod="#{condicaoPagamentoBean.completeFormaPagamento}"  >
            	<p:ajax event="itemSelect" listener="#{condicaoPagamentoBean.handleSelectFormaPagamento}" update="pgFormaPagamento" />
			</p:autoComplete>         
		</h:panelGrid>   
    </p:panel>	
    <p:commandButton value="Consultar" actionListener="#{condicaoPagamentoBean.findCondicaoPagamento}" update="dataTableCondicaoPagamento" styleClass="commandButton" /> 
	<p:commandButton value="Novo" action="#{condicaoPagamentoBean.newCondicaoPagamento}" styleClass="commandButton" /> 
	<p:commandButton value="Limpar"  actionListener="#{condicaoPagamentoBean.clean}" update="panelConsultarCondicaoPagamento, dataTableCondicaoPagamento" styleClass="commandButton" />
    
   		
     <p:dataTable id="dataTableCondicaoPagamento" var="CondicaoPagamento" value="#{condicaoPagamentoBean.dmCondicaoPagamento}"  
    			 rowKey="CondicaoPagamento.idCondicaoPagamento" selectionMode="single"
                 style="padding-top:20px; width:60%" paginator="true" rows="10"  
                 paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"  
                 rowsPerPageTemplate="5,10,15">  
        <f:facet name="header">Condições de Pagamento</f:facet>    
		<p:column sortBy="#{CondicaoPagamento.idCondicaoPagamento}" style="width:10%; text-align:center">  
            <f:facet name="header">  
                <h:outputText value="Código" />  
            </f:facet>  
            <h:outputText value="#{CondicaoPagamento.idCondicaoPagamento}" />  
        </p:column>  
  
        <p:column sortBy="#{CondicaoPagamento.descricao}">  
            <f:facet name="header">  
                <h:outputText value="CondicaoPagamento" />  
            </f:facet>  
            <h:outputText value="#{CondicaoPagamento.descricao}" />  
        </p:column>  
        
        <p:column sortBy="#{CondicaoPagamento.formaPagamento.descricao}">  
            <f:facet name="header">  
                <h:outputText value="Forma de Pagamento" />  
            </f:facet>  
            <h:outputText value="#{CondicaoPagamento.formaPagamento.descricao}" />  
        </p:column>  
        
        <p:column style="width:4%; text-align:center">  
        	<f:facet name="header">
        	 <h:outputText value="Editar" />
        	</f:facet>
         	<p:commandButton id="selectButtonEditar" action="#{condicaoPagamentoBean.editarCondicaoPagamento}" icon="ui-icon-pencil" process="@this" title="Detail" />
        </p:column> 
        
        <p:column style="width:4%; text-align:center">  
        	<f:facet name="header">
        	 <h:outputText value="Excluir" />
        	</f:facet>
         	<p:commandButton id="selectButtonDelete" action="#{condicaoPagamentoBean.excluirCondicaoPagamento}" icon="ui-icon-trash" process="@this" title="Delete" />
        </p:column>
    </p:dataTable>    
</h:form>  	
</ui:define>
</ui:composition>
